package com.bawei.library_base.room.good;

import android.content.Context;

import androidx.room.Database;
import androidx.room.Room;
import androidx.room.RoomDatabase;

/**
 * @author : zhiyu
 * @date : 2021/12/16
 * @content :
 */
@Database(entities = {Good.class},version = 1,exportSchema = false)
public abstract class GoodDatabase extends RoomDatabase {
    private  static  final  String DB_NAME = "good.db";
    private    static  volatile  GoodDatabase instance;

    public  synchronized  static  GoodDatabase getInstance(Context context){
        if(instance==null){
            instance =  Room.databaseBuilder(
                    context,
                    GoodDatabase.class,
                    DB_NAME).allowMainThreadQueries().build();
        }
        return instance;
    }

    public  abstract GoodDao getGoodDao();

}
